home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 08 Nov 2000
- // Author: bwk
- //
- // Description:
- // This script updates the size of the close buttons attached
- // to the main window components. This script also creates a
- // popup menu parented to the component close boxes that
- // contains a list of all the other main window components.
- //
- // The updateUIComponentCloseButtons() procedure should only be
- // called once at startup.
- //
- // If a particular component changes size then it is up to that
- // component to update it's corresponding close button.
- //
-
- global proc updateUIComponentCloseButtons()
- //
- // Description:
- // Query the size of all the main window components and then set
- // the corresponding close button so it is equal in height for
- // horizontal components or width for vertical components.
- //
- // Also create a popup menu parented to the close button
- // containing all the components.
- //
- // This procedure should only be called once during startup.
- //
- //
- {
- // The names of all the horizontal components.
- //
- string $horizontalComponentArray[] = {
- "Status Line",
- "Shelf",
- "Time Slider",
- "Range Slider",
- "Command Line",
- "Help Line"
- };
-
- // The names of all the vertical components.
- //
- string $verticalComponentArray[] = {
- "Tool Box",
- "Attribute Editor",
- "Tool Settings",
- "Channel Box / Layer Editor"
- };
-
- int $buttonSize, $componentSize;
-
- // For each horizontal component query it's height and then
- // apply that height to the corresponding close button.
- //
- for ($horizontalComponent in $horizontalComponentArray) {
- $component = getUIComponent($horizontalComponent);
- $closeButton = getUIComponentCloseButton($horizontalComponent);
- $componentSize = `control -query -height $component`;
- $buttonSize = `control -query -height $closeButton`;
- if ($buttonSize < $componentSize) {
- control -edit -height $componentSize $closeButton;
- }
- createUIComponentCloseButtonPopupMenu($closeButton);
- }
-
- // For each vertical component query it's width and then
- // apply that width to the corresponding close button.
- //
- for ($verticalComponent in $verticalComponentArray) {
- $component = getUIComponent($verticalComponent);
- $closeButton = getUIComponentCloseButton($verticalComponent);
- $componentSize = `control -query -width $component`;
- $buttonSize = `control -query -width $closeButton`;
- if ($buttonSize < $componentSize) {
- control -edit -width $componentSize $closeButton;
- }
- createUIComponentCloseButtonPopupMenu($closeButton);
- }
- }
-
- global proc createUIComponentCloseButtonPopupMenu(string $parent)
- //
- // Description:
- // Create a popup menu containing items for all the main window
- // components.
- //
- // Note that the menu items are not actually created at this
- // time. They are created when the menu is posted by the user.
- //
- // Arguments:
- // $parent - The parent button for the popup menu.
- //
- {
- string $popupMenu = `popupMenu -parent $parent -button 3`;
-
- popupMenu -edit
- -postMenuCommand ("createUIComponentCloseButtonPopupMenuItems " + $popupMenu)
- $popupMenu;
- }
-
- global proc createUIComponentCloseButtonPopupMenuItems(string $popupMenu)
- //
- // Description:
- // Create the component menu items for the close button popup menu.
- //
- // Arguments:
- // $popupMenu - The parent popup menu for the menu items.
- //
- {
- int $itemCount, $visible;
-
- // Delete all the existing items.
- //
- $itemCount = `popupMenu -query -numberOfItems $popupMenu`;
- if (0 < $itemCount) {
- popupMenu -edit -deleteAllItems $popupMenu;
- }
-
- createUIComponentMenuItems($popupMenu);
- }
-
- global proc createUIComponentMenuItems(string $parentMenu)
- //
- // Description:
- // Create menu items for controlling the visibility of the main
- // window UI elements.
- //
- // Arguments:
- // $parentMenu - Any parent menu.
- //
- {
- setParent -menu $parentMenu;
-
- // Get the visibility of each main window component and create
- // a menu item for it.
-
- $visible = isUIComponentVisible("Status Line");
- menuItem -checkBox $visible -label "Status Line"
- -annotation (getRunTimeCommandAnnotation("ToggleStatusLine"))
- -command ("ToggleStatusLine");
-
- $visible = isUIComponentVisible("Shelf");
- menuItem -checkBox $visible -label "Shelf"
- -annotation (getRunTimeCommandAnnotation("ToggleShelf"))
- -command ("ToggleShelf");
-
- $visible = isUIComponentVisible("Time Slider");
- menuItem -checkBox $visible -label "Time Slider"
- -annotation (getRunTimeCommandAnnotation("ToggleTimeSlider"))
- -command ("ToggleTimeSlider");
-
- $visible = isUIComponentVisible("Range Slider");
- menuItem -checkBox $visible -label "Range Slider"
- -annotation (getRunTimeCommandAnnotation("ToggleRangeSlider"))
- -command ("ToggleRangeSlider");
-
- $visible = isUIComponentVisible("Command Line");
- menuItem -checkBox $visible -label "Command Line"
- -annotation (getRunTimeCommandAnnotation("ToggleCommandLine"))
- -command ("ToggleCommandLine");
-
- $visible = isUIComponentVisible("Help Line");
- menuItem -checkBox $visible -label "Help Line"
- -annotation (getRunTimeCommandAnnotation("ToggleHelpLine"))
- -command ("ToggleHelpLine");
-
- menuItem -divider true;
-
- $visible = isUIComponentVisible("Tool Box");
- menuItem -checkBox $visible -label "Toolbox"
- -annotation (getRunTimeCommandAnnotation("ToggleToolbox"))
- -command ("ToggleToolbox");
-
- menuItem -divider true;
-
- $visible = isUIComponentVisible("Attribute Editor");
- menuItem -checkBox $visible -label "Attribute Editor"
- -annotation (getRunTimeCommandAnnotation("ToggleAttributeEditor"))
- -command ("ToggleAttributeEditor");
-
- $visible = isUIComponentVisible("Tool Settings");
- menuItem -checkBox $visible -label "Tool Settings"
- -annotation (getRunTimeCommandAnnotation("ToggleToolSettings"))
- -command ("ToggleToolSettings");
-
- $visible = isUIComponentVisible("Channel Box / Layer Editor");
- menuItem -checkBox $visible -label "Channel Box / Layer Editor"
- -annotation (getRunTimeCommandAnnotation("ToggleChannelsLayers"))
- -command ("ToggleChannelsLayers");
-
- menuItem -divider true;
-
- menuItem -label "Hide UI Elements"
- -annotation (getRunTimeCommandAnnotation("HideUIElements"))
- -command ("HideUIElements");
-
- menuItem -label "Show UI Elements"
- -annotation (getRunTimeCommandAnnotation("ShowUIElements"))
- -command ("ShowUIElements");
-
- menuItem -label "Restore UI Elements"
- -annotation (getRunTimeCommandAnnotation("RestoreUIElements"))
- -command ("RestoreUIElements");
- }
-